dojo.declare("MobileMainPgBkUp", wm.Page, {
	start: function() {
		
	},
	"preferredDevice": "phone",

    loginButtonClick: function(inSender) {
        this.loginErrorMsg.setCaption("");
        dojo.cookie("user", this.usernameInput.getDataValue(), {
            expires: 365
        });
    },
    
    onLoginSuccess: function() {
        if (window["PhoneGap"]) {
            this.phonegapCredentialStorage.setData({
                name: this.usernameInput.getDataValue(),
                dataValue: this.passwordInput.getDataValue()
            });
        }
    },
    loginFailed: function(inResponse) {
        this.loginErrorMsg.setCaption("Invalid username or password.");
        this.usernameInput.focus();
    },
    restorePhonegapCredentials: function() {        
        var username = this.phonegapCredentialStorage.getValue("name");
        var password = this.phonegapCredentialStorage.getValue("dataValue");
        if (username || password) {
            this.usernameInput.setDataValue(username);
            this.passwordInput.setDataValue(password);
            if (username && password) {
                this.loginVariable1.update();
            }
        }
    },	_end: 0
});